<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <cpn2></cpn2>
</div>
<script src="../js/vue.js"></script>
<script>
  // 1.创建第一个组件
  const cpnC1 = Vue.extend({
    template: `
    <div>
      <h2>我是内容</h2>
    </div>
    `
  })
  // 子组件必须写在<div>里面否则会报错>多根root
  const cpnC2 = Vue.extend({
    template: `
      <div>
        <h2>我是第二各组件</h2>
        <cpn1></cpn1>
      </div>
    `,
    components: {
      cpn1: cpnC1
    }
  })
  const app = new Vue({
    el: '#app',
    data: {
      message: "你好",
    },
    components: {
      cpn2: cpnC2
    }
  })
</script>
</body>
</html>
